A flexible and convenient high-level mmap for zero-copy file I/O.
English | 简体中文
Design
The design of this crate is inspired by Dgraph's mmap file implementation in Stretto.
All of file-backed memory map has the potential for Undefined Behavior (UB) if the underlying file is subsequently modified (e.g. the file is deleted by another process), in or out of process, this crate tries to avoid this situation by provide file lock APIs.
This crate supports std and popular async runtime(tokio, async-std, smol), and thanks to macro
in Rust, it is super easy to support any new async runtime. For details, please see the implementation for tokio, async-std, smol of the source code.
Features
- dozens of file I/O util functions
- file-backed memory maps
- synchronous and asynchronous flushing
- copy-on-write memory maps
- read-only memory maps
- stack support (
MAP_STACK
on unix) - executable memory maps
- file locks.
- tokio
- smol
- async-std
Installation
-
std
[] = 0.2
-
[] = { = "0.3", = ["tokio-async"] }
-
[] = { = "0.3", = ["std-async"] }
-
[] = { = "0.3", = ["smol-async"] }
Examples
This crate is 100% documented, see documents for examples.
TODO
- add benchmarks